package imageProcessing.filter;

import imageProcessing.ImageEvent;
import imageProcessing.ImageListener;

import java.beans.EventSetDescriptor;
import java.beans.MethodDescriptor;
import java.beans.ParameterDescriptor;
import java.beans.SimpleBeanInfo;
import java.lang.reflect.Method;

public class AndFilterBeanInfo extends SimpleBeanInfo {
	public EventSetDescriptor[] getEventSetDescriptors() {
		try {
			EventSetDescriptor esd1;
			Class c = AndFilter.class;
			String es = "image";
			Class lc = ImageListener.class;
			String names[] = { "imageChanged" };
			String al = "addImageListener";
			String rl = "removeImageListener";
			esd1 = new EventSetDescriptor(c, es, lc, names, al, rl);

			EventSetDescriptor esd[] = { esd1 };
			return esd;
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return null;
	}

	public MethodDescriptor[] getMethodDescriptors() {
		try {
			Class c = AndFilter.class;

			Class parameterTypes[] = new Class[1];
			parameterTypes[0] = ImageEvent.class;
			String name = "leftImageChanged";
			Method method1 = c.getMethod(name, parameterTypes);
			ParameterDescriptor pds[] = new ParameterDescriptor[1];
			pds[0] = new ParameterDescriptor();
			MethodDescriptor md1;
			md1 = new MethodDescriptor(method1, pds);

			Class parameterTypes3[] = new Class[1];
			parameterTypes3[0] = ImageEvent.class;
			String name3 = "rightImageChanged";
			Method method3 = c.getMethod(name3, parameterTypes3);
			ParameterDescriptor pds3[] = new ParameterDescriptor[1];
			pds3[0] = new ParameterDescriptor();
			MethodDescriptor md3;
			md3 = new MethodDescriptor(method3, pds3);

			MethodDescriptor mds[] = { md1, md3 };
			return mds;
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return null;
	}

}
